var api = require('./api.js')
var request = require('./request.js')

// function getHome(params) {
//   return request.requestApi({
//     url: api.homeApi
//   })
// }
 // 登录接口
function loginFn(params) {
  return request.requestApi({
    url: api.loginFn,
    data: params,
    method: 'POST'
  })
}
// 获取题目信息
function getTopic(params) {
  return request.requestApi({
    url: api.getTopic,
    data: params,
    header: {
      'Content-type': 'application/json',
      'Authorization': wx.getStorageSync("token")
    },
    method: 'POST'
  })
}

// 判断答题
function answer(params) {
  return request.requestApi({
    url: api.answer,
    data: params,
    header: {
      'Content-type': 'application/json',
      'Authorization': wx.getStorageSync("token")
    },
    method: 'POST'
  })
}


// 判断答题
function secedeFn(params) {
  return request.requestApi({
    url: api.secedeFn,
    data: params,
    header: {
      'Content-type': 'application/json',
      'Authorization': wx.getStorageSync("token")
    },
    method: 'POST'
  })
}

// 结束答题
function overFn(params) {
  return request.requestApi({
    url: api.overFn,
    data: params,
    header: {
      'Content-type': 'application/json',
      'Authorization': wx.getStorageSync("token")
    },
    method: 'POST'
  })
}

// 获取用户信息
function getUserInfo(params) {
  return request.requestApi({
    url: api.getUserInfo,
    data: params,
    header: {
      'Content-type': 'application/json',
      'Authorization': wx.getStorageSync("token")
    },
    method: 'POST'
  })
}
module.exports = {
  loginFn,
  getTopic,
  answer,
  secedeFn,
  overFn,
  getUserInfo
}